package com.ruoyi.biz.service.casetype.impl;

import org.springframework.stereotype.Service;

import com.ruoyi.biz.bean.bo.LitigateTypeBO;
import com.ruoyi.biz.bean.vo.qo.LitigateTypeQO;
import com.ruoyi.biz.domain.LitigateType;
import com.ruoyi.biz.mapper.LitigateTypeMapper;
import com.ruoyi.biz.service.casetype.ILitigateTypeService;
import com.ruoyi.comm.crud.service.impl.BaseBQImpls;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.utils.StringUtils;

/**
 * 案件类型信息 服务层处理
 * 
 * @author riverbo
 */
@Service
public class LitigateTypeServiceImpl extends BaseBQImpls<LitigateTypeMapper, LitigateType, LitigateTypeBO, LitigateTypeQO> implements ILitigateTypeService {

	@Override
	public Boolean checkNameUnique(LitigateType t) {
        Long boId = StringUtils.isNull(t.getLitigateTypeId()) ? -1L : t.getLitigateTypeId();
        Long dbId = this.baseMapper.getIdByName(t);
        if (StringUtils.isNotNull(dbId) && dbId.longValue() != boId.longValue()) {
            return UserConstants.NOT_UNIQUE;
        }
        return UserConstants.UNIQUE;
	}

}
